//
//  UILabel+BSHelper.m
//  BSOrange
//
//  Created by Bean on 14-9-5.
//  Copyright (c) 2014年 BazzarEntertainment. All rights reserved.
//

#import "UILabel+BSHelper.h"

@implementation UILabel(Italic)

-(void)setFont:(UIFont *)font isRightItalic:(BOOL)isRightItalic
{
    CGFloat left = -1;
    if (isRightItalic) {
        left = 1;
    }
    CGAffineTransform matrix =  CGAffineTransformMake(1, 0, left*tanf(10 * (CGFloat)M_PI / 180), 1, 0, 0);
    UIFontDescriptor *desc = [UIFontDescriptor fontDescriptorWithName :font.fontName matrix :matrix];
    self.font = [UIFont fontWithDescriptor :desc size :font.pointSize];
}

@end


@implementation UIFont(Italic)

- (UIFont *)BS_fontOfItalic;
{
    CGFloat left = 1;
    CGAffineTransform matrix =  CGAffineTransformMake(1, 0, left*tanf(10 * (CGFloat)M_PI / 180), 1, 0, 0);
    UIFontDescriptor *desc = [UIFontDescriptor fontDescriptorWithName :self.fontName matrix :matrix];
    UIFont *font = [UIFont fontWithDescriptor :desc size :self.pointSize];
    return font;
}

@end
